<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>margin塌陷问题</title>
    <style>
      .outer {
        /* box-sizing: border-box; */
        width: 400px;
        /* height: 400px; */
        background-color: gray;

        /* 三种解决方案，最后一种适合，这个是历史遗留问题 */
        /* border: 1px solid transparent; */
        /* padding: 1px; */
        overflow: hidden;
      }

      .inner1 {
        width: 100px;
        height: 100px;
        background-color: orange;

        margin-top: 50px;
        margin-bottom: 50px;
      }

      .inner2 {
        width: 100px;
        height: 100px;
        background-color: skyblue;
      }
    </style>
  </head>
  <body>
    <!-- 第一个子元素的margintop和最后一个marginbottom会作用到父元素上 -->
    <div class="outer">
      <div class="inner1">inner1</div>
      <div class="inner2">inner2</div>
    </div>
  </body>
</html>
